package com.lft.examsys.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lft.examsys.entity.Role;
import com.lft.examsys.mapper.RoleMapper;
import com.lft.examsys.model.IModel;
import com.lft.examsys.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Service
public class RoleService {
    @Autowired
    private RoleMapper roleMapper;

    public void getRoleByPage(IModel model, Integer page, Integer size, String elName) {
        PageUtil.getAllByPage(model, page, size, roleMapper, elName);
    }

    public boolean delete(String id) {
        return roleMapper.deleteById(id) > 0;
    }

    public void add(String id, String name) {
        roleMapper.add(id,name);
    }

    public List<Role> getAllRole() {
        return roleMapper.getAllRole();
    }
}
